<?php
namespace Home\Controller;
use Think\Controller;
class ContentController extends PublicController {
    public function __construct(){
        parent::__construct();
    }

    public function info(){
    	$id = I('path.2');
        $data = M('content as a')
            ->join('left join room_content_type as rct on a.room_content_type_id = rct.id left join user as b on a.user_id = b.id left join city as c on b.city_id = c.id left join type as d on a.type_id = d.id')
            ->field('a.* , b.uuid , b.nick_name , b.head_ico , b.exp, c.name as city_name , b.major ,b.school_end_time , d.name as type_name ,rct.need_inside_look')
            ->where("a.id = ".$id)
            ->find();
        $sql = "UPDATE content set click = click+1 where id = ".$id;
        M()->execute($sql);


        $data = D('Content')->parse_content($data,$this->user['id']);

        
        $room_content_type = M('room_content_type')->where('id = '.$data['room_content_type_id'])->find();
        
        $data['create_time']=date("Y-m-d H:i:s",$data['create_time']);
        if ($data['need_inside_look'] == 1 || $room_content_type['need_inside_look'] == 1) {
            $data['title'] = "该内容涉密，无权限查看";
            $data['content'] = "该内容涉密，无权限查看";
            $data['nick_name'] = "该内容涉密，无权限查看";

            $data['imgs'] = array();
            $data['videos'] = array();
            $data['files'] = array();
        }

        $this->info = $data;
        $this->display();
    }

    

}